import React, { useState } from 'react'
import { Table, Button } from 'antd'
export default () => {
    const [selectedRowKeys, setSelectedRowKeys] = useState([])
    const columns = [
        {
            title: '表名',
            dataIndex: 'name',
            key: 'name',
            render: (text: any) => <a>{text}</a>,
        },
        {
            title: '数据量',
            dataIndex: 'age',
            key: 'age',
        },
        {
            title: '数据大小',
            dataIndex: 'address',
            key: 'address',
        },
        {
            title: '创建时间',
            key: 'tags',
            dataIndex: 'tags',
        }
    ];

    const data = [
        {
            key: '1',
            name: 'John Brown',
            age: 32,
            address: 'New York No. 1 Lake Park',
            tags: '2018',
        },
        {
            key: '2',
            name: 'Jim Green',
            age: 42,
            address: 'London No. 1 Lake Park',
            tags: '2018',
        },
        {
            key: '3',
            name: 'Joe Black',
            age: 32,
            address: 'Sidney No. 1 Lake Park',
            tags: '2018',
        },
    ];

    const rowSelection = {
        selectedRowKeys,
        onChange: (selectedRowKeys: any) => {
            setSelectedRowKeys(selectedRowKeys)
            console.log('selectedRowKeys changed: ', selectedRowKeys);
            // this.setState({ selectedRowKeys });
        }
    };
    return (
        <div>
            <div style={{ textAlign: "right", marginBottom: "10px" }}>
                <Button type="primary">备份</Button>
            </div>
            <Table columns={columns} dataSource={data} pagination={false} rowSelection={rowSelection} />
        </div>
    )
}